package com.ksfzhaohui.nio.channels;

import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;

public class FilePosititon {

	public static void main(String[] args) throws Exception {
		RandomAccessFile randomAccessFile = new RandomAccessFile(
				"gatherTest.txt", "r");
		randomAccessFile.seek(100);
		FileChannel fileChannel = randomAccessFile.getChannel();
		System.out.println("file pos:" + fileChannel.position());

		randomAccessFile.seek(500);
		System.out.println("file pos:" + fileChannel.position());

		fileChannel.position(200);
		System.out.println("file pos:" + randomAccessFile.getFilePointer());

	}
}
